package com.hl.mapper;

import com.hl.pojo.PsychologicalTopic;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PsychologicalTopicMapper {
    // 添加心理话题
    @Insert("insert into psychological_topic (title, text, pa_id) values (#{title}, #{text}, #{paId})")
    public Integer add(PsychologicalTopic psychologicalTopic);

    // 查询所有心理话题
    @Select("select * from psychological_topic")
    public List<PsychologicalTopic> findAll();

    // 根据id删除心理话题
    @Update("delete from psychological_topic where id = #{id}")
    public Integer del(Integer id);

    // 根据id查询心理话题
    @Select("select * from psychological_topic where pa_id = #{id}")
    public List<PsychologicalTopic> findById(Integer id);

    // 更新心理话题
    @Update("update psychological_topic set title=#{title}, text=#{text}, pa_id=#{paId} where id=#{id}")
    public Integer update(PsychologicalTopic psychologicalTopic);
}